package main;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.awt.geom.Point2D.Double;

import javax.swing.JApplet;
/**
 * Brick class. Represent both graphic and physical object.
 * @author Leo
 *
 */
public class Brick extends GameFrame {
    /**
     * Default constructor.
     * @param x start point y
     * @param y start point x
     * @param w width
     * @param h height
     */
    public Brick(final double x, final double y, final double w, final double h) {
        super(x, y, w, h);
    }
    @Override
    public final Point2D calculateNextPosition(final float timeDelta) {
        double x = getPosition().getX() + getSpeed().getX() * timeDelta;
        double y = getPosition().getY() + getSpeed().getY() * timeDelta;
        Point2D newPos = new Point2D.Double(x, y);
        return newPos;
    }

    public void paint(Graphics g) {
        Color c = g.getColor();
        g.setColor(Color.blue);
   
        g.fillRect((int) brickRectangle2d.getX(),
                (int) brickRectangle2d.getY(), (int) brickRectangle2d
                .getWidth(), (int) brickRectangle2d.getHeight());
        g.setColor(c);
    }

}
